<template>
  <div :class="[`nav-theme-${navTheme}`, `nav-theme-${navLayout}`]">
    <a-layout id="components-layout-demo-side" style="min-height: 100vh">
      <a-layout-sider
        v-if="navLayout === 'left'"
        :trigger="null"
        collapsible
        v-model="collapsed"
        :theme="navTheme"
        width="256px"
      >
        <div class="logo">
          <img src="@/assets/logo.png" alt />
        </div>
        <SiderMenu :theme="navTheme" :collapsed="collapsed" />
      </a-layout-sider>
      <a-layout>
        <a-layout-header style="background: #fff; padding: 0">
          <a-icon
            v-auth="['admin']"
            :type="collapsed ? 'menu-unfold' : 'menu-fold'"
            class="trigger"
            @click="collapsed = !collapsed"
          ></a-icon>
          <Header></Header>
        </a-layout-header>
        <a-layout-content style="margin: 24px 24px 0">
          <router-view></router-view>
        </a-layout-content>
        <a-layout-footer style="textAlign: center">
          <Footer></Footer>
        </a-layout-footer>
      </a-layout>
    </a-layout>
    <Authorized :authority="['admin']">
      <SettingDrawer />
    </Authorized>
  </div>
</template>
<script>
import Header from "./Header";
import Footer from "./Footer";
import SiderMenu from "./SiderMenu";
import SettingDrawer from "../components/SettingDrawer";
// import Logo from "@/assets/logo.png";
export default {
  name: "",
  components: {
    Header,
    Footer,
    SiderMenu,
    SettingDrawer
    // Logo
  },
  data() {
    return {
      collapsed: false
    };
  },
  computed: {
    navTheme() {
      return this.$route.query.navTheme || "light";
    },
    navLayout() {
      return this.$route.query.navLayout || "left";
    }
  },
  methods: {}
};
</script>
<style lang="less" scoped>
#components-layout-demo-responsive .logo {
  height: 32px;
  background: rgba(255, 255, 255, 0.2);
  margin: 16px;
}
.trigger {
  padding: 0 20px;
  line-height: 64px;
  font-size: 20px;

  &:hover {
    background: #eeeeee;
  }
}

.logo {
  position: relative;
  height: 180px;
  padding-left: 24px;
  overflow: hidden;
  line-height: 180px;
  background: #fff;
  img {
    width: 41px;
  }
  svg {
    width: 32px;
    height: 32px;
    display: inline-block;
    vertical-align: middle;
  }

  h1 {
    display: inline-block;
    margin: 0 0 0 12px;
    font-size: 20px;
    font-family: Avenir, "Helvetica Neue", Arial, Helvetica, sans-serif;
    font-weight: 600;
    vertical-align: middle;
  }
}

.nav-theme-dark {
  /deep/ .logo {
    background: #002140;
    h1 {
      color: #ffffff;
    }
  }
}
</style>
